B12 - Equation
提出
code: python
import math
n = int(input())
# x は実数
# 0.000 < x < 100.000
# O(pow(10, 9))
l = 0.000000
r = 100.000000
while l < r:
mid = (l+r) // 2
ans = mid**3 + mid
if ans > n:
r = mid - 1
else:
l = mid + 1
print(l)
解答
code: python
n = int(input())
l = 0.0
r = 100.0
for i in range(20):
mid = (l + r) / 2
val = mid**3 + mid
if val > n:
r = mid
else:
l = mid
print(mid)